<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2021/10/17
  Time: 15:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript" src="../static/js/jquery-3.6.0.js"></script>
<html>
<head>
    <title>试题测试</title>
    <style>
        .left{float:left}
        .right{float: right}
        .left2{float:left}
        .right2{float: right}
    </style>
</head>
<body>
<div align="center"><h1 >${exampaperTest.eTitle}</h1></div>
<div><span class="left">考试学生：${sysName}</span>
    <span class="right">考试剩余时间:${exampaperTest.validateTime}</span>
</div><br>
<div><span class="left2">考试科目：${exampaperTest.courseName}</span>
    <span class="right2">考试时间${testTime}分钟,总分${exampaperTest.fulscore}</span>
</div><br>

<form action="${pageContext.request.contextPath}/questionTest" method="post">
    <c:forEach var="danXuan" items="${questionDanXuans}" varStatus="status">
        <c:if test="${status.first}" >
            <h4>一、 ${danXuan.quesType} （每小题 ${danXuan.quesScore} 分）</h4>
        </c:if>
        ${status.count} .${danXuan.ques}<br>
        <input type="radio" name="danXuan${status.count}" value="A"><span>${danXuan.optionA}</span>
        <input type="radio" name="danXuan${status.count}" value="B"><span>${danXuan.optionB}</span>
        <input type="radio" name="danXuan${status.count}" value="C"><span>${danXuan.optionC}</span>
        <input type="radio" name="danXuan${status.count}" value="D"><span>${danXuan.optionD}</span>

    <div></div>
        <script>
            var danxuan=$('input[@name=danXuan${status.count}][@checked]').val();
            var score=0;
            if(danxuan==${danXuan.quesAnswer}){
                score=score+${danXuan.quesScore};

            }
        </script>
    </c:forEach>
    <c:forEach var="duoXuan" items="${questionDuoXuans}" varStatus="status">
        <c:if test="${status.first}" >
            <h4>二、${duoXuan.quesType}（每小题${duoXuan.quesScore}分）</h4>
        </c:if>
        ${status.count} .${duoXuan.ques}<br>
        <input type="checkbox" name="duoXuan${status.count}" value="A"><span>${duoXuan.optionA}</span>
        <input type="checkbox" name="duoXuan${status.count}" value="B"><span>${duoXuan.optionB}</span>
        <input type="checkbox" name="duoXuan${status.count}" value="C"><span>${duoXuan.optionC}</span>
        <input type="checkbox" name="duoXuan${status.count}" value="D"><span>${duoXuan.optionD}</span>
        <div></div>

    </c:forEach>

    <c:forEach var="panDuan" items="${questionPanDuans}" varStatus="status">
        <c:if test="${status.first}" >
            <h4>三、${panDuan.quesType}（每小题${panDuan.quesScore}分）</h4>
        </c:if>
        ${status.count} .${panDuan.ques}<br>
        <input type="radio" name="panDuan${status.count}" value="A"><span>${panDuan.optionA}</span>
        <input type="radio" name="panDuan${status.count}" value="B"><span>${panDuan.optionB}</span>

        <div></div>
    </c:forEach>
    <div align="center"><input type="submit" value="提交" onclick="PiGai();"/></div>


</form>
<script language="JavaScript">
    function PiGai() {

        session.setAttribute("score",score);
        document.addForm.submit();

    }

</script>
</body>
</html>
